import request from '@/utils/request'

/** ****************************商家管理*******************************************/
export function getMerchantsList(data) {
  var requestUrl
  if (data.sellerId === undefined) {
    requestUrl = '/v1/seller/getSellerListVo?current=' + data.current + '&size=' + data.size + '&censorStatus=' + data.censorStatus
  } else {
    requestUrl = '/v1/seller/getSellerListVo?current=' + data.current + '&size=' + data.size + '&censorStatus=' + data.censorStatus + '&sellerId=' + data.sellerId
  }
  return request({
    url: requestUrl,
    method: 'POST'
  })
}
export function getShopList(data) {
  return request({
    url: '/v1/shop/selectAll?current=' + data.current + '&size=' + data.size,
    method: 'POST',
    data: data
  })
}

export function editorMerchantsList(data) {
  return request({
    url: '/v1/seller/addOrEditSeller',
    method: 'POST',
    data: data
  })
}
export function statusMerchantsList(data) {
  return request({
    url: '/v1/seller',
    method: 'PUT',
    data: data
  })
}
export function delMerchantsList(data) {
  return request({
    url: '/v1/seller',
    method: 'DELETE',
    data: data
  })
}
export function searchMerchantsList(data, url) {
  return request({
    url: '/v1/seller/getSellerListVo?current=' + data.current + '&size=' + data.size + url,
    method: 'POST'
  })
}
// 省市区三级联动
export function getProvinces(data) {
  return request({
    url: '/v1/sysRegion?current=1&size=9999&parentId=' + data.parentId,
    method: 'GET'
  })
}

/** ****************************商家Banner管理*******************************************/
export function getBannerstoreList(data) {
  return request({
    url: '/v1/sellerBanner?current=' + data.current + '&size=' + data.size + '&sellerId=' + data.sellerId,
    method: 'GET'
  })
}
export function addShop(data) {
  return request({
    url: '/v1/shop/addShop',
    method: 'POST',
    data: data
  })
}
export function addBannerstoreList(data) {
  return request({
    url: '/v1/sellerBanner',
    method: 'POST',
    data: data
  })
}

export function getCompanyName() {
  return request({
    url: '/v1/shop/getCompanyName',
    method: 'GET'
  })
}
export function editShop(data) {
  return request({
    url: '/v1/shop',
    method: 'PUT',
    data: data
  })
}
export function editorBannerstoreList(data) {
  return request({
    url: '/v1/sellerBanner',
    method: 'PUT',
    data: data
  })
}
export function delShop(data) {
  return request({
    url: '/v1/shop',
    method: 'DELETE',
    data: data
  })
}

export function delBannerstoreList(data) {
  return request({
    url: '/v1/sellerBanner',
    method: 'DELETE',
    data: data
  })
}
export function searchBannerstoreList(data) {
  return request({
    url: '/v1/sellerBanner?current=' + data.current + '&size=' + data.size + '&advertName=' + data.advertName + '&type=' + data.type,
    method: 'GET'
  })
}

// 店铺审核
export function statusMerchant(data) {
  return request({
    url: '/v1/seller/aplicationSeller',
    method: 'POST',
    data: data
  })
}

// 生成二维码
export function getminiqrCode(data) {
  return request({
    url: '/wx/getminiqrQr',
    method: 'POST',
    data: data
  })
}

// 同步商品
export function getMerchantsListAll() {
  return request({
    url: '/v1/item/selectAllList?sellerId=0&itemSource=0&itemType=0&listStatus=1&isDeleted=0',
    method: 'GET'
  })
}
export function getSynchronous(data) {
  return request({
    url: '/v1/syncItem/selectItemIntersection?sellerId=' + data.sellerId,
    method: 'GET'
  })
}
export function delBatchList(data) {
  return request({
    url: '/v1/syncItem',
    method: 'DELETE',
    data: data
  })
}
export function saveBatchList(data) {
  return request({
    url: '/v1/syncItem/saveBatchItem',
    method: 'POST',
    data: data
  })
}

// 图片base64
export function base64Img(data) {
  return request({
    url: '/wx/imageConvertBase64',
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    data: data
  })
}
// 是否开启全网购
export function editorUpdateIsNetwork(data) {
  return request({
    url: '/v1/seller/updateIsNetwork',
    method: 'PUT',
    data: data
  })
}
